package com.example.demo.huawei;

import java.util.Scanner;

/**
 * 字符串s 收尾相连成一个环形 请你在s中找出 l o x出现偶数次
 * 最长子字符串的长度
 * alolobo
 * 6
 * looxdolx
 * 7
 * bcbcbc
 * 6
 */
public class Main22 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        System.out.println(largestLength(s));

    }

    //* alolobo
    // * 6
    private static int largestLength(String s) {
        int maxLength = 0;
        char[] array = s.toCharArray();
        for (int i = 0; i < array.length; i++) {
            int countL = 0;
            int countO = 0;
            int countX = 0;
            for (int j = 0; j < array.length; j++) {
                int index = (i + j) % array.length;
                char ch = array[index];
                switch (ch) {
                    case 'l':
                        countL++;
                        break;
                    case 'x':
                        countX++;
                        break;
                    case 'o':
                        countO++;
                        break;
                }
                if (countX % 2 == 0 && countL % 2 == 0 && countO % 2 == 0) {
                    maxLength = Math.max(maxLength, j + 1);
                }
            }
        }
        return maxLength;
    }
}
